package com.blackitheima.test1;

import java.util.TreeMap;

public class MyHashMap1 {
    public static void main(String[] args) {
        //创建集合
        TreeMap<Student,String> hm=new TreeMap<>();
        //创建对象并添加到集合中
        hm.put(new Student("小黄",24),"黄土高原");
        hm.put(new Student("小鸡",20),"土耳其");
        hm.put(new Student("风云",23),"天地会");

        //遍历
        hm.forEach(
                (Student key,String value)->{
                    System.out.println(key+"---"+value);
                }
        );

    }
}
